package org.kl.bpm.repository.conf;

import java.util.List;

import org.kl.bf.repository.BasicRepository;
import org.kl.bpm.entity.conf.BpmConfForm;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

public interface BpmConfFormDao extends BasicRepository<BpmConfForm, String>, JpaSpecificationExecutor<BpmConfForm> {
	/**
	 * 通过流程节点ID获取所有
	 * 
	 * @param bpmConfNodeId
	 * @return
	 */
	List<BpmConfForm> findByBpmConfNodeId(String bpmConfNodeId);

	/**
	 * 通过流程节点ID获取某种类型的表单
	 * 
	 * @param bpmConfNodeId
	 * @return
	 */
	List<BpmConfForm> findByBpmConfNodeIdAndType(String bpmConfNodeId, Integer type);

	/**
	 * 通过流程节点ID和bpm配置文件获取表单
	 * 
	 * @param bpmConfNodeId
	 * @return
	 */
	List<BpmConfForm> findByBpmConfNodeIdAndOriginValue(String bpmConfNodeId, String originValue);

	/**
	 * 通过XML中原始FormKey和节点ID获取表单配置
	 * 
	 * @param originValue
	 * @param code
	 * @return
	 */
	BpmConfForm findByOriginValueAndBpmConfNodeCodeAndBpmConfNodeBpmConfBaseProcessDefinitionId(String originValue, String code,
			String processDefinitionId);

	/**
	 * 通过流程定义ID和节点Key获取List BpmConfForm
	 * 
	 * @param processDefinitionId
	 * @param nodeCode
	 * @return
	 */
	List<BpmConfForm> findByBpmConfNodeBpmConfBaseProcessDefinitionIdAndBpmConfNodeCode(String processDefinitionId, String nodeCode);

	/**
	 * 通过流程定义ID和节点Key获取List BpmConfForm
	 * 
	 * @param processDefinitionId
	 * @param nodeCode
	 * @return
	 */
	List<BpmConfForm> findByBpmConfNodeBpmConfBaseProcessDefinitionIdAndBpmConfNodeCodeAndTypeOrderByCreateTimeAsc(String processDefinitionId, String nodeCode,
			Integer type);
}
